<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
#parse("/linkandscript.html")
<title>论坛控</title>
</head>
<body>
	#parse("/boardcastemb.html")
    #parse("/settingemb.html")
    <div id="indexheaderdiv">
    	<div style="background-color:#1abc9c; width:100%; height:4px;"></div>
        <div style="background-color:#1abc9c; width:80px; text-align:center; color:#FFF; font-size:20px; padding:4px; font-weight:800; margin-left:10%; float:left;">论坛控</div>
        <div style="margin-bottom:1px; padding-right:10%;  float:right; text-align:right">  
            <a id="addforumbtn" href="/hezi/forum?action=create" target="_blank" class="btn btn-primary" style="margin:4px;">新加论坛</a>
            <a class="btn btn-primary" id="settingbtn" style="margin:4px;">设置</a>
            <a class="btn btn-primary" id="settingfullbtn" style="margin:4px;" href="/hezi/setting" target="_blank">完整设置</a>
            <a class="btn btn-primary" id="feedbackbtn" style="margin:4px;" rel="leanModal" 
                        name="feedback" href="#feedback">反馈</a>        
            <a id="scanallbtn" class="batchscan btn btn-info" forumgroup="allforum" title="扫描并下载所有论坛的新帖子和新图片" style="margin:4px;" >扫描全部</a>
            <a id="viewallimagebtn" class="batchview btn btn-info" title="查看所有论坛的新图片" forumgroup="allforum" style="margin:4px;" >查看新图</a>
            <a id="viewallimagebtn" class="batchview btn btn-info" href="/hezi/postlist?postcategory=markedunproecessed" target="_blank" style="margin:4px;" >查看帖子</a>
            <a id="archivebtn" class="btn btn-info">归档</a>
            <a class="btn btn-primary" href="/hezi/scan?action=getreport" target="_blank" style="margin-top:4px; display:none">上次运行结果</a>
        </div>
    </div>
    
    
	
    
    
    <div id="forumsdiv">
        <table id="forumstable" border="0" class="center">
        
          #foreach($groupitem in $groupslist)
          <!--group-->
          <tr class="grouptr">
            <td class="grouptd">
            	<span class="groupname">$groupitem.name</span>
                <span class="groupnewimagecount">$!groupitem.getNewimagecount()</span>
                <span class="groupaction">
            
                #if($noScaninProcess)
                <a id="scanallbtn" class="batchscan btn btn-info" forumgroup="$groupitem.getId()" 
                        title="扫描并下载所有论坛的新帖子和新图片">扫描本组</a>
                #else
                    扫描进行中...
                #end
             
                #if($groupitem.getNewimagecount() > 0)
                    <a id="viewallimagebtn" class="batchview btn btn-info" forumgroup="$groupitem.getId()" title="查看所有论坛的新图片">查看本组</a>
                #end
                </span>
            </td>
          </tr>
          <tr>

          <!--forums-->
            <td style="padding-left:40px;" colspan="1">
            	#foreach($forumitem in $groupitem.getForumsInThisGroup() ) 

                       <table class="forumtable">
                          <tr>
                          	<td class="forumnewimagecount" style="position:relative">$forumitem.summary.newimagecount</td>
                            <td class="forumidtd">$forumitem.getId()</td>
                            <td class="forumnametd" style="position:relative">
                            	<span style=" position:absolute; top:0px; right:0px; font-size:10px">$forumitem.getLastscantimeHuman()</span>
                                #if(!$forumitem.isEnabled())
                                <span style=" position:absolute; top:0px; left:0px; font-size:10px">disable</span>
                                #end
                                <span style=" position:absolute; bottom:0px; left:0px; font-size:16px">$forumitem.name</span>
                                
                            </td>
                            <td class="actiontd">
                                <a class="btn btn-info scanbtn" forum="$forumitem.getId()" id="scanbtn$forumitem.getId()">扫描</a>       
                                <a class="btn btn-info viewbtn" forum="$forumitem.getId()" id="viewbtn$forumitem.getId()">查看</a>
                                <a class="btn btn-info settingbtn" forum="$forumitem.getId()" href="/hezi/forum?forum=$forumitem.getId()&action=edit" target="_blank" id="settingbtn$forumitem.getId()">设置</a>
                            </td>
                          </tr>
                        </table>
                #end<!--end of forum-->
            </td>
          </tr>
          #end<!--end of group-->    
        </table>
    </div>
    
    #parse("/feedback.html") 
</body>


<style>

#forumsdiv{
	padding-bottom:50px;
	background-image:url(/hezi/images/indexbg.png);
	background-repeat:no-repeat;
	background-position:bottom right;
}
.groupaction{
	//float:right;
	display:none;
}
.grouptd{
	height:30px;
	vertical-align:top;
}

.groupname{
	font-size:20px; 
	color:#CCC; 
	font-weight:800; 
}
.forumtable{
	width:200px;
	margin:6px;
	margin-left:20px;
	border:#eceff1 1px solid; 
	float:left; 
	font-size:16px;
}

.forumtable td{
	padding:4px;
	height:28px;
	//vertical-align:top;
}


.forumnewimagecount{
	background-color:#eceff1;
	padding-top:4px;
	width:36px; 
	text-align:center; 
	vertical-align:middle; 
	color:#1abc9c; 
}

.groupnewimagecount{
	padding-left:10px;
	color:#999;
}

.forumidtd{
	width:60px; 
	padding-left:10px; 
	padding:4px;
	text-align:right;
}

.forumnametd{
	//width:80px; 
}

.actiontd{
	display:none; 
	//background-color:#eceff1; 
}


#forumsdiv{
	width:100%; 
	padding-top:20px;
}

#forumstable{
	width:80%; 
	vertical-align:top;
}


</style>


<script language="javascript">
$(function(){
	
	$("#archivebtn").click(function(){
		$("#archivebtn").removeClass("btn-info");
		console.log("开始归档数据库")
		$.get('/hezi/setting?action=archive',function(theback)
			  {
				console.log("back:" + theback);
				$("#archivebtn").addClass("btn-info");
				}
		);	
	});
	
	
	$(".grouptd").hover(
		function(){
			tr = $(this);
			tr.find(".groupaction").toggle();
			tr.find(".groupname").toggle();
        },
		function(){
			tr = $(this);
			tr.find(".groupaction").toggle();
			tr.find(".groupname").toggle();
        }
    );
	
	
    $(".forumtable").hover(
		function(){
			tr = $(this);
			tr.find(".forumnewimagecount").toggle();
			tr.find(".forumidtd").toggle();
			tr.find(".forumnametd").toggle();
			tr.find(".actiontd").toggle();
			
			
        },
		function(){
			tr = $(this);
			tr.find(".actiontd").toggle();
			tr.find(".forumnewimagecount").toggle();
			tr.find(".forumidtd").toggle();
			tr.find(".forumnametd").toggle();
			
        }
    );
	
	
	
	$(".batchscan").click(function(){
		var forumgroup = $(this).attr("forumgroup");
		window.location.href="/hezi/scan?forumgroup="+forumgroup+"&windowwidth="+$(window).width();	
	});
	
	$(".batchview").click(function(){
		var forumgroup = $(this).attr("forumgroup");
		window.location.href="/hezi/picwall?forumgroup="+forumgroup+"&windowwidth="+$(window).width();			
	});		


	$(".scanbtn").click(function(){
		var theforum = $(this).attr("forum");
		window.location.href="/hezi/scan?forum="+theforum+"&windowwidth="+$(window).width();	
	});
	
	$(".viewbtn").click(function(){
		var theforum = $(this).attr("forum");
		window.location.href="/hezi/picwall?forum="+theforum+"&windowwidth="+$(window).width();
	});
})
</script>


</html>
